ny_noaa_data = ny_noaa %>%
  janitor::clean_names() %>% 
  separate(col = date, into = c('year', 'month','day'), sep = '-') %>%
  mutate(
    year = as.numeric(year),
    month = as.numeric(month),
    day = as.numeric(day),
    prcp = prcp/10, 
    tmax = as.numeric(tmax) / 10,
    tmin = as.numeric(tmin) / 10)

Total Monthly Precipitation in NYC in 2006 - Barplot

ny_noaa_data %>% 
  select(id, year, month, prcp) %>% 
  group_by(month) %>% 
  drop_na(prcp) %>% 
  filter(year == 2006) %>% 
  mutate(month = recode(month, 
                        '1' = 'January', 
                        '2' = 'February',
                        '3' = 'March', 
                        '4' = 'April', 
                        '5' = 'May', 
                        '6' = 'June',
                        '7' = 'July',
                        '8' = 'August',
                        '9' = 'September',
                        '10' = 'October',
                        '11' = 'November',
                        '12' = 'December')) %>%
  plot_ly(
    x = ~month, y = ~prcp, color = ~month, type = "bar") %>% 
  layout(
    xaxis = list(title = "<b> Month </b>",
                 categoryorder = "array", 
                 categoryarray = ~month), 
    yaxis = list(title = "<b> Precipitation (mm) </b>"),
    legend = list(title = list(text = "<b> Month </b>")))
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors

## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors

Chart B

Average Maximum & Minimum Temperatures (C) in January - Scatterplot

ny_noaa_data %>%
  select(id, year, month, tmax, tmin) %>% 
  group_by(year) %>% 
  drop_na(tmax, tmin) %>% 
  filter(month == 1) %>% 
  mutate(month = recode(month, 
                        '1' = 'January'),
         mean_tmax = mean(tmax), 
         mean_tmin = mean(tmin)) %>% 
  select(-tmin, -tmax) %>% 
  pivot_longer(
    mean_tmax:mean_tmin, 
    names_to = "temp_observation", 
    values_to = "temp_measurement") %>% 
  mutate(temp_observation = recode(temp_observation, 
                                   'mean_tmax' = "Average Max Temperature",
                                   'mean_tmin' = "Average Min Temperature")) %>% 
  plot_ly(
    x = ~year, y = ~temp_measurement, color = ~temp_observation, 
    type = 'scatter', mode = 'markers') %>% 
  layout(
    xaxis = list(title = "<b> Year </b>"),
    yaxis = list(title = "<b> Temperature (C) </b>"), 
    legend = list(title = list(text = "<b> Temperature Observation </b>")))
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels